﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

using Meqs.Entity;
using Meqs.Logic.Interface;

public partial class School_TeacherList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    //初始化教师姓名树列表
    [System.Web.Services.WebMethod]
    public static List<TeacherInfo> InitTeacherList()
    {
        List<TeacherInfo> teacherlist = new List<TeacherInfo>();
        ITeacherInfoLogic teacherInfoLogic = Container<ITeacherInfoLogic>.Instance;
        teacherlist = (List<TeacherInfo>)teacherInfoLogic.GetAllTeacherOrderByPinyin(Common.GetConstSchoolMark());
        return teacherlist;
    }

    [System.Web.Services.WebMethod]
    public static int InsertTeacherToCause(int TeachID,int iCauseID)
    {
        Hashtable ht = new Hashtable();
        ht.Add("TeachID", TeachID);
        ht.Add("CauseID", iCauseID);

        int iCount = Container<ITeachClsCauseLogic>.Instance.FindCount(ht);

        //如果已经存在，则返回-1
        if (iCount > 0)
            return -1;

        //添加教师到关系表中
        TeachClsCause tcc = new TeachClsCause(TeachID, iCauseID, 0);
        Container<ITeachClsCauseLogic>.Instance.InsertTeachClsCause(tcc);

        return 1;

    }

}
